package com.seecoder.BlueWhale.vo;

import com.seecoder.BlueWhale.enums.CategoryEnum;
import com.seecoder.BlueWhale.po.Commodity;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.Date;
import java.util.List;

@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
public class CommodityVO {
    private Integer id;     //商品id

    private String name;    //商品名

    private CategoryEnum category; //商品品类

    private Integer storeId;       //所属商店的id

    private List<String> photoUrl;  //图片url

    private Integer quantity;        //商品库存，实际商店中的库存

    private Integer expectQuantity;  //预期库存，用户下单后，发货前的库存

    private float price;       //商品价格

    private Date createTime;  //创建时间

    private float rating;       //评价

    private Integer commentNumber; //评价个数

    public Commodity toPO(){
        Commodity commodity = new Commodity();
        commodity.setId(this.id);
        commodity.setName(this.name);
        commodity.setCategory(this.category);
        commodity.setStoreId(this.storeId);
        commodity.setPhotoUrl(this.photoUrl);
        commodity.setQuantity(this.quantity);
        commodity.setExpectQuantity(this.expectQuantity);
        commodity.setPrice(this.price);
        commodity.setCreateTime(this.createTime);
        commodity.setRating(this.rating);
        commodity.setCommentNumber(this.commentNumber);
        return commodity;
    }
}
